package com.handinglian.servicerecord.mapper;

import com.handinglian.servicerecord.dto.*;
import com.handinglian.servicerecord.entity.CallRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.Date;
import java.util.List;

@Mapper
public interface CallRecordMapper {
    int deleteByPrimaryKey(Integer callRecordId);

    int insert(CallRecord record);

    int insertOrUpdate(CallRecord record);

    int insertOrUpdateSelective(CallRecord record);

    int insertSelective(CallRecord record);

    CallRecord selectByPrimaryKey(Integer callRecordId);

    int updateByPrimaryKeySelective(CallRecord record);

    int updateByPrimaryKey(CallRecord record);

    int updateBatch(List<CallRecord> list);

    int batchInsert(@Param("list") List<CallRecord> list);

    List<String> findFileUuidBycCallidIn(@Param("callidCollection") Collection<String> callidCollection);

    CallRecord findOneByCallid(@Param("callid") String callid);

    List<String> findReqidByStartTimeBetween(@Param("minStartTime") Date minStartTime, @Param("maxStartTime") Date maxStartTime);

    List<String> findCallid();

    List<CallRecordDto> inquireCallRecordPageList(@Param("userIds") List<Integer> userIds, @Param("userNameOrJobNum") String userNameOrJobNum, @Param("likeCustomerNo") String likeCustomerNo, @Param("minStartTime") Date minStartTime, @Param("maxStartTime") Date maxStartTime, @Param("recordStatusList") List<Integer> recordStatusList, @Param("phoneStatusList") List<Integer> phoneStatusList, @Param("hasRecords") String hasRecords, @Param("sortField") String sortField, @Param("sortOrder") String sortOrder);

    List<CallRecord> findByRecordStatusIn(@Param("recordStatusCollection") Collection<Integer> recordStatusCollection);

    CallRecordDetailDto findOneByCallRecordId(@Param("callRecordId") Integer callRecordId);

    Integer countTaskCallNum(@Param("taskUserCallIds") List<Integer> taskUserCallIds);

    Integer countTaskAnswerNum(@Param("taskUserCallIds") List<Integer> taskUserCallIds);

    List<CallRecord> findCallRecordByUserIdIn(@Param("userIdCollection") Collection<Integer> userIdCollection);

    List<CallRecord> findAnswerRecordByUserIdIn(@Param("userIdCollection") Collection<Integer> userIdCollection);

    CallRecord loadCallRecordByUserIdCustomerNo(@Param("userId") Integer userId, @Param("customerNo") String customerNo, @Param("minStartTime") Date minStartTime, @Param("maxStartTime") Date maxStartTime);

    List<CallRecord> findByCustomerNoAndUserId(@Param("customerNo") String customerNo, @Param("userId") Integer userId);

    List<CallRecord> findAnswerRecordByCustomerNoAndUserId(@Param("userId") Integer userId, @Param("customerNo") String customerNo);

    List<CallRecordAppDto> list(@Param("answerState") Integer answerState, @Param("userId") Integer userId);

    List<CallIndexDto> countCallRecord(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<CallRecord> findByCallRecordIdIn(@Param("callRecordIdCollection")Collection<Integer> callRecordIdCollection);

    List<CallRecord> findAnswer(@Param("callRecordIdCollection")Collection<Integer> callRecordIdCollection);

    List<CallRecordExcel> findCallRecordExcel();

    Integer countCallout();

    Integer countCalloutEveryday();

}